package com.wanmait.travel.vo;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
public class Pager {
	private List data;
	private int pageNum;
	private int rowCount;
	private int pageSize =3;
	
	public boolean hasPrev() {
		return pageNum>1;
	}
	
	public boolean hasNext() {
		return pageNum<this.getPageCount();
	}
	
	public static Pager init(String pargeNumStr) {

		int pageNum=1;
		try {
			pageNum=Integer.parseInt(pargeNumStr);
		} catch (NumberFormatException e) {
		}
		Pager pager =new Pager();
		pager.setPageNum(pageNum);
		
		return pager;
	}
	
	
	
	public int getPageCount() {
		if(rowCount<0) {
			return 1;
		}
		return (rowCount+(pageSize-1))/pageSize;
	}
	
	public List getData() {
		return data;
	}

	public void setData(List data) {
		this.data = data;
	}

	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public int getRowCount() {
		return rowCount;
	}

	public void setRowCount(int rowCount) {
		this.rowCount = rowCount;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	
}
